package sk.tramtatiri.pages.users;

import org.apache.wicket.model.Model;

import sk.tramtatiri.MySession;
import sk.tramtatiri.core.IConstants;

public class RecipesPage extends UserPageTemplate {

	public RecipesPage() {
		CollapsibleBorder borderCreate = new CollapsibleBorder("borderCreateRecipe", new Model("Vytvorit recept"), new Model("Vytvorit recept"));
		RecipeCreatePanel recipeCreatePanel = new RecipeCreatePanel("recipeCreatePanel");
		
		CollapsibleBorder borderShow = new CollapsibleBorder("borderShowRecipes", new Model("Zoznam receptov"), new Model("Zoznam receptov"));
		RecipeShowPanel recipeShowPanel = new RecipeShowPanel("recipeShowPanel");
		borderShow.setCollapsed(false);
		
		if (((MySession)getSession()).hasPermission()) {
			borderCreate.setVisible(true);
		} else {
			borderCreate.setVisible(false);
		}
		
		borderCreate.add(recipeCreatePanel);
		borderShow.add(recipeShowPanel);
		add(borderCreate);
		add(borderShow);
	}
	
	@Override
	public String getPageTitle() {
		return IConstants.PAGE_NAME+" - Recepty";
	}

}
